package com.hlx.mapper;

import com.hlx.entiry.dto.MajorDTO;
import com.hlx.entiry.po.ConsultationAppointment;
import com.hlx.entiry.vo.MajorVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MajorMapper {
	/**
	 * 查询专业信息
	 * @param majorDTO
	 * @return
	 */
	List<MajorVO> selectMajor(MajorDTO majorDTO);

	/**
	 * 查询所有学院名称
	 * @return
	 */
	@Select("select name from college")
	List<String> selectAllCollege();

	/**
	 * 根据学院名称查询专业信息
	 * @param collegeName
	 * @return
	 */
	List<MajorVO> selectByCollege(String collegeName);

	/**
	 * 插入预约信息
	 * @param appointment
	 */
	@Insert("insert into consultation_appointment(username, contact, target_info, notes) values(#{username}, #{contact}, #{targetInfo}, #{notes})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	void insertAppointment(ConsultationAppointment appointment);
}
